package com.ruoyi.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.utils.ObjectFieldUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 股票对象 mini_stock
 * 
 * @author ruoyi
 * @date 2023-11-07
 */
@TableName("mini_stock")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class MiniStock implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 股票id */
    @TableId(type = IdType.AUTO)
    private Long id;

    /** 股票编码 */
    @Excel(name = "股票编码")
    private String stockNo;

    /** 股票名称 */
    @Excel(name = "股票名称")
    private String name;

    @Excel(name = "题材名称")
    @TableField(exist = false)
    private String subjectName;
    /** 题材id */
    @TableField(exist = false)
    private String subjectIds;
    /** 题材id数组 */
    @TableField(exist = false)
    private List<Long> subjectIdList;

    /** 显示顺序 */
    @Excel(name = "显示顺序")
    private Integer sort;

    /** 概要 */
    @Excel(name = "概要")
    private String outline;

    /** 详情 */
    @Excel(name = "详情")
    private String detail;

    /** 是否可点击 0不可以1可以 */
    @Excel(name = "是否可点击 0不可以1可以")
    private String top;
    /** 涨跌幅 */
    @Excel(name = "涨跌幅")
    private BigDecimal rise;
    /** 重要性 */
    @Excel(name = "重要性")
    private Integer importance;

    /** 删除标志（0代表存在 2代表删除） */
    @Excel(name = "删除标志", readConverterExp = "0=代表存在,2=代表删除")
    private String deleted;
    /**
     * 题材层级
     */
    @TableField(exist = false)
    private Integer level;

    /** 创建者 */
    private String createBy;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    private String updateBy;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 当前价格(元) */
    @Excel(name = "当前价格(元)")
    private BigDecimal price;

    /** 流通市值(元) */
    @Excel(name = "流通市值(元)")
    private BigDecimal flowMarketValue;
    /** 总市值(元) */
    @Excel(name = "总市值(元)")
    private BigDecimal totalMarketValue;
    @Excel(name = "市盈率")
    private BigDecimal priceEarningsRatio;
    @Excel(name = "换手率 ")
    private BigDecimal turnoverRate;

    /** 搜索值 */
    @JsonIgnore
    @TableField(exist = false)
    private String searchValue;
    /** 请求参数 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private Map<String, Object> params;
    @TableField(exist = false)
    private String ancestors;
    @TableField(exist = false)
    private Long subjectId;
    @TableField(exist = false)
    private List<Long> stockIds;

    public List<Long> getStockIds() {
        return stockIds;
    }

    public void setStockIds(List<Long> stockIds) {
        this.stockIds = stockIds;
    }

    public Long getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(Long subjectId) {
        this.subjectId = subjectId;
    }

    public BigDecimal getTurnoverRate() {
        return turnoverRate;
    }

    public void setTurnoverRate(BigDecimal turnoverRate) {
        this.turnoverRate = turnoverRate;
    }

    public BigDecimal getPriceEarningsRatio() {
        return priceEarningsRatio;
    }

    public void setPriceEarningsRatio(BigDecimal priceEarningsRatio) {
        this.priceEarningsRatio = priceEarningsRatio;
    }

    public List<Long> getSubjectIdList() {
        return subjectIdList;
    }

    public void setSubjectIdList(List<Long> subjectIdList) {
        this.subjectIdList = subjectIdList;
    }

    public String getAncestors() {
        return ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getSearchValue()
    {
        return searchValue;
    }

    public void setSearchValue(String searchValue)
    {
        this.searchValue = searchValue;
    }

    public String getCreateBy()
    {
        return createBy;
    }

    public void setCreateBy(String createBy)
    {
        this.createBy = createBy;
    }

    public Date getCreateTime()
    {
        return createTime;
    }

    public void setCreateTime(Date createTime)
    {
        this.createTime = createTime;
    }

    public String getUpdateBy()
    {
        return updateBy;
    }

    public void setUpdateBy(String updateBy)
    {
        this.updateBy = updateBy;
    }

    public Date getUpdateTime()
    {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime)
    {
        this.updateTime = updateTime;
    }


    public Map<String, Object> getParams()
    {
        if (params == null)
        {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params)
    {
        this.params = params;
    }
    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public BigDecimal getRise() {
        return rise;
    }

    public void setRise(BigDecimal rise) {
        this.rise = rise;
    }

    public String getSubjectName() {
        return subjectName;
    }

    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setStockNo(String stockNo)
    {
        this.stockNo = stockNo;
    }

    public String getStockNo()
    {
        return stockNo;
    }
    public void setName(String name) 
    {
        this.name = name;
    }

    public String getName() 
    {
        return name;
    }
    public void setSubjectIds(String subjectIds)
    {
        this.subjectIds = subjectIds;
    }

    public String getSubjectIds()
    {
        return subjectIds;
    }
    public void setSort(Integer sort) 
    {
        this.sort = sort;
    }

    public Integer getSort() 
    {
        return sort;
    }
    public void setOutline(String outline) 
    {
        this.outline = outline;
    }

    public String getOutline() 
    {
        return outline;
    }
    public void setDetail(String detail) 
    {
        this.detail = detail;
    }

    public String getDetail() 
    {
        return detail;
    }
    public void setTop(String top)
    {
        this.top = top;
    }

    public String getTop()
    {
        return top;
    }
    public void setImportance(Integer importance) 
    {
        this.importance = importance;
    }

    public Integer getImportance() 
    {
        return importance;
    }
    public void setDeleted(String deleted) 
    {
        this.deleted = deleted;
    }

    public String getDeleted() 
    {
        return deleted;
    }

    public BigDecimal getFlowMarketValue() {
        return flowMarketValue;
    }

    public void setFlowMarketValue(BigDecimal flowMarketValue) {
        this.flowMarketValue = flowMarketValue;
    }

    public BigDecimal getTotalMarketValue() {
        return totalMarketValue;
    }

    public void setTotalMarketValue(BigDecimal totalMarketValue) {
        this.totalMarketValue = totalMarketValue;
    }

    public MiniStock() {
    }
    public MiniStock(Long id, BigDecimal rise) {
        this.id = id;
        this.rise = rise;
    }

    public MiniStock(Long id, BigDecimal rise, BigDecimal price) {
        this.id = id;
        this.rise = rise;
        this.price = price;
    }

    public MiniStock(Long id, BigDecimal rise, BigDecimal price, BigDecimal flowMarketValue, BigDecimal totalMarketValue, BigDecimal priceEarningsRatio,BigDecimal turnoverRate) {
        this.id = id;
        this.rise = rise;
        this.price = price;
        this.flowMarketValue = flowMarketValue;
        this.totalMarketValue = totalMarketValue;
        this.priceEarningsRatio = priceEarningsRatio;
        this.turnoverRate = turnoverRate;
    }

    public MiniStock(Long id, String stockNo, String name, Integer sort, String outline, String createBy, Date createTime) {
        this.id = id;
        this.stockNo = stockNo;
        this.name = name;
        this.sort = sort;
        this.outline = outline;
        this.createBy = createBy;
        this.createTime = createTime;
    }

    public MiniStock(Long id, Integer sort, String outline, String updateBy) {
        this.id = id;
        this.sort = sort;
        this.outline = outline;
        this.updateBy = updateBy;
    }

    public boolean updateStockCheck() {
        return ObjectFieldUtils.isAllFieldsNull( this,true,"id");
    }
}
